<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>个人文章列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="icon" th:href="@{/读书1.jpg}" type="image/jpg" >
    <link rel="stylesheet" href="../static/layui-v2.5.7/layui/css/layui.css" th:href="@{/layui-v2.5.7/layui/css/layui.css}">
    <!--  -->
    <script src="http://cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
    <script src="../static/layui-v2.5.7/layui/layui.js" th:src="@{/layui-v2.5.7/layui/layui.js}"></script>
    <!--  -->
</head>

<style>

    body{
        background-color: rgb(246,246,246);
        min-width: 1450px;
    }

    .head{
         position: fixed;
         width:100%;
         top:0;
         z-index:1;
    }

    .head_div1{
        width:355px;
        height: 30px;
        display: inline-block;
        /* border: 1px solid red; */
        float: right;
        margin: 15px 15px 0px 0px;
        background-color:rgb(57,61,73);
    }

    .head_div1_input1{
        height: 30px;
        width: 300px;
        border-radius: 5px 5px 5px 5px;
        border: none;
        background-color:rgb(232, 232, 232);
        float: left;
    }

    .head_div1_button{
        height: 30px;
        width: 50px;
        border-radius: 5px 5px 5px 5px;
        background-color:rgb(57,61,73);
        border: 1px solid white;
        //font-family: '楷体';
        font-size: 15px;
        line-height: 30px;
        color: white;
        float: right;
    }

    .head_div2{
        float: right;
        display: inline-block;
        margin-right: 15px;
    }

    .head a {
        //color: black !important;
    }

    .div_body{
        background-color: rgb(246,246,246);
        /* 这个白边不能去 */
        border: 1px solid white;
        margin: 75px auto 20px;
        width: 85%;
        min-height:469px;
        //border: 1px solid red;
    }
   /*  */
    .div_body_div1{
        height:300px;
        width: 200px;
        //border: 1px solid red;
        float:right;
        background-color: white;
        //margin-right:20px;
    }

    .div_body_div1>a>div{
        height:60px;
        width: 100%;
        //border: 1px solid red;
        line-height:60px;
        text-align:center;
    }

    .div_body_div1>a>div:hover{
        background-color:rgb(240,240,245);
    }

   .div_body_div2{
        //border-bottom: 1px solid rgb(246,246,246);
        //margin: 15px auto 0px;
        width: 82%;
        min-height:520px;
        border: 1px solid white;
        background-color: white;
   }
<!---->
   .div_body_div2_div1{
        border-top:1px solid rgb(232, 232, 232);
        border-bottom:1px solid rgb(232, 232, 232);
        margin: 15px auto;
        width: 95%;
        height:120px
   }

   .div_body_div2_div1_div1{
        //border:1px solid red;
        display:inline-block;
        float:left;
        width: 120px;
        height:120px;
   }

   .div_body_div2_div1_div1>img{
        width: 100%;
        height:100%;
   }

   .div_body_div2_div1_div2{
        //border:1px solid red;
        display:inline-block;
        float:left;
        width: 70%;
        height:60px;
        line-height:60px;
        overflow: hidden;
        color: #007BFF;
        font-size:16px;
        //font-weight:700;
        margin-left:10px;
   }

   .div_body_div2_div1_div3{
        //border:1px solid red;
        display:inline-block;
        float:left;
        width: 70%;
        height:60px;
        margin-left:10px;
   }

   .div_body_div2_div1_div3_div1{
        //border:1px solid red;
        display:inline-block;
        float:left;
        width:85%;
        height:60px;
        line-height:60px;
   }

   .div_body_div2_div1_div3_div1_img{
        //border:1px solid red;
        border-radius:20px;
        margin-top:15px;
        float:left;
        width:30px;
        height:30px;
   }

   .div_body_div2_div1_div3_div1>span{
        color: #8a8a8a;
        font-size: 16px;
        margin-left:10px;
   }

   .div_body_div2_div1_div3_div1_span3{
        font-weight:700;
   }

   .div_body_div2_div1_div3_div2{
        //border:1px solid red;
        display:inline-block;
        float:right;
        width: 150px;
        height:60px;
   }

   .div_body_div2_div1_div4{
        //border:1px solid red;
        display:inline-block;
        float:right;
        width: 90px;
        height:120px;
        margin-right:5px;
   }
<!---->
   /* */


   /*  */
    .div_foot {
        width: 100%;
        /* border: 1px red solid; */
        height: 100px;
        background-color: white;
        background-color: rgb(57,61,73);
    }

    a {
        text-decoration: none;
    }

    .div_foot_div1 {
        /* border: red 1px solid; */
        width: 990px;
        height: 85px;
        display: inline-block;
        position: relative;
        top: 10px;
        left: 240px;
        text-align: center;
        font-size: 12px;
        line-height: 150%;
        font-family: Arial, Verdana, 宋体;
        color:white;
    }

    .div_foot_div1 div {
        margin-top: 10px;
    }

    .div_foot_div1_div1 a {
        margin: 0 10px;
        color:white;
    }

</style>

<body>

<div class="head">
    <ul class="layui-nav">

        <li class="layui-nav-item">
            <a th:href="@{/index}">
                <i class="layui-icon layui-icon-home"></i>
                首页
            </a>
        </li>

        <li class="layui-nav-item ">
            <a href="">
                <i class="layui-icon layui-icon-notice"></i>
                系统消息
            </a>
        </li>

        <li class="layui-nav-item">
            <a href="javascript:;">
                <i class="layui-icon layui-icon-read"></i>
                文章类型
            </a>
            <dl class="layui-nav-child">
                <!-- 二级菜单 -->
                <dd><a th:href="@{/list/10/1}">Java</a></dd>
                <dd><a th:href="@{/list/11/1}">C++</a></dd>
                <dd><a th:href="@{/list/12/1}">Python</a></dd>
                <dd><a th:href="@{/list/13/1}">JavaScript</a></dd>
                <dd><a th:href="@{/list/14/1}">C语言</a></dd>
                <dd><a th:href="@{/list/15/1}">云计算</a></dd>
            </dl>
        </li>

        <li class="layui-nav-item">
            <a th:href="@{/post}">
                <i class="layui-icon layui-icon-chat"></i>
                论坛
            </a>
        </li>

        <div class="head_div1">
                <input class="head_div1_input1" name="title" placeholder="&nbsp 输 入 你 的 文 章 标 题">
                <button class="head_div1_button"><i class="layui-icon layui-icon-search" style="font-size: 25px;"></i></button>
        </div>

        <div class="head_div2">

            <li class="layui-nav-item">
                <a th:href="@{/friends}">
                    <i class="layui-icon layui-icon-friends"></i>
                    好友列表
                </a>
            </li>

            <li class="layui-nav-item">
                <a><img th:src="${session.user.headImg}" class="layui-nav-img"><span th:text="${session.user.username}">2</span></a>
                <dl class="layui-nav-child">

                    <dd>
                        <a th:href="@{/outLogin(id = ${session.user.id})}">
                            <i class="layui-icon layui-icon-logout"></i>
                            退了
                        </a>
                    </dd>

                </dl>
            </li>

        </div>
    </ul>

</div>

<div class="div_body">

    <div class="div_body_div1">
        <a th:href="@{/personalBlog}"><div style="background-color:rgb(240,240,245);">我的博客</div></a>
        <a th:href="@{/personalPost}"><div>我的帖子</div></a>
        <a th:href="@{/toPersonalCommentsList}"><div>我的评论</div></a>
        <a th:href="@{/toPersonalReplyList}"><div>我的回复</div></a>
        <a th:href="@{/personalInformation}"><div>我的信息</div></a>
    </div>

    <div class="div_body_div2">

<!--            <div class='div_body_div2_div1'>-->

<!--                <div class='div_body_div2_div1_div1'><img src='../static/读书1.jpg'></div>-->
<!--                <a href="">-->
<!--                    <div class='div_body_div2_div1_div2'>耍沙沙</div>-->
<!--                </a>-->

<!--                <div class='div_body_div2_div1_div4'>-->
<!--                    <br>-->
<!--                    <a class="layui-btn layui-btn-danger"><i class="layui-icon layui-icon-delete"></i>删除</a>-->
<!--                    <br>-->
<!--                    <br>-->
<!--                    <a class="layui-btn layui-btn-warm"><i class="layui-icon layui-icon-edit"></i>修改</a>-->
<!--                </div>-->
<!--                <div class='div_body_div2_div1_div3'>-->
<!--                    <div class='div_body_div2_div1_div3_div1'>-->
<!--                        <img src='../static/读书1.jpg' class='div_body_div2_div1_div3_div1_img'>-->
<!--                        <span class='div_body_div2_div1_div3_div1_span1'>不能</span>-->
<!--                        <span class='div_body_div2_div1_div3_div1_span2'>发布于</span>-->
<!--                        <span class='div_body_div2_div1_div3_div1_span3'>2019-04-15 15:32:18</span>-->
<!--                    </div>-->
<!--                    <div class='div_body_div2_div1_div3_div2'></div>-->
<!--                </div>-->

<!--            </div>-->

    </div>

</div>

<!-- 底部相同部分 -->
<div th:replace="foot::#foot"></div>

</body>
<!--  -->
<script th:inline="javascript">
    <!-- layui -->
    layui.use('element', function () {
        var element = layui.element;
    });

    var userId = [[${session.user.id}]];

    <!--  -->
    layui.use(['flow','form'],function(){
        var flow=layui.flow,form=layui.form;
        $('.div_body_div2').empty();
        flow.load ({
            elem: '.div_body_div2', //指定列表容器
            end:"下面没有内容了",
            done:function(page,next){
                var list=[];
                $.ajax({
                    url:'/ImagineCommunity/personalBlogList',
                    data:{pageNo:page,
                          userId:userId,
                    },
                    success:function(res){
                        console.log(res);
                        $.each(res.page.items, function(index, item){
                            list.push(
                                "<div class='div_body_div2_div1'>" +
                                "<div class='div_body_div2_div1_div1'><img src='" + item.filePath + "'></div>" +
                                "<a href='/ImagineCommunity/blogDetails?id=" + item.id + "'>" +
                                "<div class='div_body_div2_div1_div2'>" + item.title + "</div>" +
                                "</a>" +
                                "<div class='div_body_div2_div1_div4'><br>" +
                                "<input type='hidden' class='hidden_input' value=' " + item.id + " '>" +
                                "<a class='layui-btn layui-btn-danger delete'><i class='layui-icon layui-icon-delete'></i>删除</a><br><br>" +
                                "<a class='layui-btn layui-btn-warm' href='/ImagineCommunity/updatePersonalBlog?id=" + item.id + "'><i class='layui-icon layui-icon-edit'></i>修改</a>" +
                                "</div>" +
                                "<div class='div_body_div2_div1_div3'>" +
                                "<div class='div_body_div2_div1_div3_div1'>" +
                                "<img src='" + item.headImg + "' class='div_body_div2_div1_div3_div1_img'>" +
                                "<span class='div_body_div2_div1_div3_div1_span1'>" + item.userName + "</span>" +
                                "<span class='div_body_div2_div1_div3_div1_span2'>发布于</span>" +
                                "<span class='div_body_div2_div1_div3_div1_span3'>" + item.createTime + "</span>" +
                                "</div>" +
                                "<div class='div_body_div2_div1_div3_div2'></div>" +
                                "</div>" +
                                "</div>"
                            );
                        })
                        next(list.join(''), page < res.page.pageTotal);
                    }
                })
            }
        })
    })

    <!-- 搜索自己的blog -->
    $(".head_div1_button").click(function(){
        var searchValue = ($(".head_div1_input1").val());
        layui.use(['flow','form'],function(){
            var flow=layui.flow,form=layui.form;
            $('.div_body_div2').empty();
            flow.load ({
                elem: '.div_body_div2', //指定列表容器
                end:"下面没有更多话题了!",
                done:function(page,next){
                    var list=[];
                    $.ajax({
                        url:'/ImagineCommunity/searchPersonalBlog',
                        data:{pageNo:page,
                              userId:userId,
                              searchValue:searchValue,
                        },
                        success:function(res){
                            console.log(res);
                            $.each(res.page.items, function(index, item){
                                list.push(
                                    "<div class='div_body_div2_div1'>" +
                                    "<div class='div_body_div2_div1_div1'><img src='" + item.filePath + "'></div>" +
                                    "<a href='/ImagineCommunity/blogDetails?id=" + item.id + "'>" +
                                    "<div class='div_body_div2_div1_div2'>" + item.title + "</div>" +
                                    "</a>" +
                                    "<div class='div_body_div2_div1_div4'><br>" +
                                    "<input type='hidden' class='hidden_input' value=' " + item.id + " '>" +
                                    "<a class='layui-btn layui-btn-danger delete'><i class='layui-icon layui-icon-delete'></i>删除</a><br><br>" +
                                    "<a class='layui-btn layui-btn-warm' href='/ImagineCommunity/updatePersonalBlog?id=" + item.id + "'><i class='layui-icon layui-icon-edit'></i>修改</a>" +
                                    "</div>" +
                                    "<div class='div_body_div2_div1_div3'>" +
                                    "<div class='div_body_div2_div1_div3_div1'>" +
                                    "<img src='" + item.headImg + "' class='div_body_div2_div1_div3_div1_img'>" +
                                    "<span class='div_body_div2_div1_div3_div1_span1'>" + item.userName + "</span>" +
                                    "<span class='div_body_div2_div1_div3_div1_span2'>发布于</span>" +
                                    "<span class='div_body_div2_div1_div3_div1_span3'>" + item.createTime + "</span>" +
                                    "</div>" +
                                    "<div class='div_body_div2_div1_div3_div2'></div>" +
                                    "</div>" +
                                    "</div>"
                                );
                            })
                            next(list.join(''), page < res.page.pageTotal);
                        }
                    })
                }
            })
        })
    })

    <!--  -->
    $(document).on('click', '.delete', function() {
        var blogId = $(this).parent().find('.hidden_input').val();
        var thisClick = $(this);
        console.log(blogId);
        layui.use('layer', function () {
            layer.confirm('确定要删除此博客么', function (index) {
                $.ajax({
                    url:'/ImagineCommunity/deleteBlog',
                    data:{id:blogId},
                    success:function(res){
                        layer.msg("删除成功!");
                        setTimeout(function() {
                            $(thisClick).parent().parent().remove();
                        }, 1000);
                    }
                })
            })
        });
    })

    <!-- 浏览器关闭事件,浏览器关闭时向后台发送退出链接 -->
    $(window).unload(function(){
        $.ajax({
            url : "/ImagineCommunity/outLogin?id=[[${session.user.id}]]",
        })
    });

</script>
</html>